package ga.individuals;

import com.mathworks.toolbox.javabuilder.MWException;
import com.mathworks.toolbox.javabuilder.MWNumericArray;

import neuralnetwork.NeuralNetwork;

public class Fitness {
	private static NeuralNetwork neuralNetwork;
	
	private Fitness(){}
	
	public static Double getFitnessValue (final Individual individual) throws MWException {
		if (neuralNetwork == null) {
			neuralNetwork = new NeuralNetwork();
		}
		
		return ((MWNumericArray)(neuralNetwork.main(1, individual.getIndividualValue())[0])).getDouble();
	}
}
